package com.example.gesture_test;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class AddPopup extends Activity{	
	private EditText content;
	private Button ok;
	private Button cancel;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		final Intent i = getIntent();
		
		setContentView(R.layout.add_popup);
		content = (EditText)findViewById(R.id.newItem);
		ok = (Button)findViewById(R.id.btn_OK);
		cancel = (Button)findViewById(R.id.btn_Cancel);
		
		ok.setOnClickListener(new OnClickListener(
				) {
			
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				String con = content.getText().toString();
				if(con!=null&&!con.equals(""))
				{
					i.putExtra("button", 1);
					i.putExtra("content", con);
					setResult(RESULT_OK,i);
					finish();
				}
			}
		});
		
		cancel.setOnClickListener(new OnClickListener(
				) {
			
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				i.putExtra("button", 0);
				setResult(RESULT_OK,i);
				finish();
			}
		});
		
	}
}
